<?php

namespace app\admin\controller;

use think\Db;
use think\Request;

class Index extends Base
{
    /**
     * 首页页面
     * @return \think\response\View
     */
    public function index()
    {
        $menus = config('menus.');
        $persimmon = $this->persimmon;
        return view('index/index', compact('menus', 'persimmon'));
    }

    /**
     * 桌面页面
     * @param Request $request
     * @return \think\response\View
     */
    public function desktop(Request $request)
    {
        $server = [
            "host" => $request->host(),
            "os" => PHP_OS,
            "os_version" => php_uname(),
            "run_env" => $request->server('HTTP_CONNECTION'),
            "php_version" => PHP_VERSION,
            "browser_version" => $request->server('HTTP_USER_AGENT'),
            "mysql_version" => Db::query("select version() as version")[0]['version'],
            "disk_free_space" => round(disk_free_space('/') / 1024 / 1024 / 1024, 5) . "G",
            'max_upload' => ini_get("file_uploads") ? ini_get("upload_max_filesize") : "Disabled",
            'max_ex_time' => ini_get("max_execution_time") . "秒",
        ];
        return view('index/desktop', compact('server'));
    }
}
